package dao.review;

import java.util.List;

import util.paramvo.PageListParamVO;
import vo.ReviewVO;

import com.ibatis.sqlmap.client.SqlMapClient;

public class ReviewDAOImpl implements ReviewDAO{

	private SqlMapClient sqlMapClient;

	public void setSqlMapClient(SqlMapClient sqlMapClient) {
		this.sqlMapClient = sqlMapClient;
	}

	@Override
	public List<ReviewVO> getUnapprovalReviewList(PageListParamVO param) throws Exception {
		return sqlMapClient.queryForList("review.getUnapprovalReviewList", param);
	}

	@Override
	public int countUnapprovalReviewList() throws Exception {
		return (Integer) sqlMapClient.queryForObject("review.countUnapprovalReviewList");
	}

	@Override
	public void approveReview(ReviewVO param) throws Exception {
		sqlMapClient.update("review.approveReview", param);
	}

	@Override
	public ReviewVO getReview(int review_no) throws Exception {
		return (ReviewVO) sqlMapClient.queryForObject("review.getReview", review_no);
	}

	@Override
	public List<Integer> getWriters(int majorunit_no) throws Exception {
		return sqlMapClient.queryForList("review.getWriters", majorunit_no);
	}
}
